package com.bai.boot.Util;

import lombok.Data;
import org.springframework.stereotype.Component;

/**
 *
 * Json格式的数据进行响应
 * @author 27471
 * Time : 2022/9/30 20:22
 */
@Component
@Data
public class JsonResult<E> {
    //状态码
    private  Integer state;
     //描述信息
    private String message;
    //数据
    private E data;

    public JsonResult() {
    }

    public JsonResult(Integer state) {
        this.state = state;
    }
    public JsonResult(Throwable e) {
        this.message = e.getMessage();
    }
    public JsonResult(Integer state, E data) {
        this.state = state;
        this.data = data;
    }
}
